﻿using HLStock.Common;
using HLStock.Model;
using HLStock.WmsService;

namespace HLStock.ModelSetup
{
    public class StockInOrderSetup : IDefValSetter<StockRecordModel>
    {
        public void SetupModel(StockRecordModel t)
        {
            if (t.Type == StockType.Out) return;
            var orderSP = ServiceLoader.GetService<OrderServiceProvider>();
            var order = orderSP.SearchBySubOrder(t.QrCode);
            t.ProductCode = order.ProductCode;
            t.ProductName = order.ProductName;
            t.OrderCode = order.OrderCode;
        }
    }
}
